<?php
namespace app\index\controller;

use app\index\model\Step as StepModel;
use think\Request;
use think\Log;
class Step extends Base
{
    //添加学生到表中
    public function doAdd(Request $request)
    {
        //从提交表单中获取数据
        $data = $request -> param();
        Log::record('code'.var_export($data,true),'info');

        //新增学生记录
        $result = StepModel::create($data);

        //设置返回数据
        $status = 0;
        $message = '添加失败,请检查';

        //检测更新结果,将结果返回给grade_edit模板中的ajax提交回调处理
        if (true == $result) {
            $status = 1;
            $message = '恭喜, 添加成功~~';
        }
        return ['status'=>$status, 'message'=>$message];
    }

}